	function Combox(id) {
		//对象
		this.id = id;
		this.obj = document.getElementById(id);
		
		this.objButton = document.getElementById(id+".button");
		this.objDiv = new SelectableDivs(document.getElementById(id+".div"), false, true);
		this.opened = false;
		this.match = (this.obj.getAttribute("matchOption") != null);
		
		//参数
		//动态获取选项的相关参数
		this.url = this.obj.getAttribute("url");
		this.content = this.obj.getAttribute("content");
		
		if (this.url == null && this.content != null) {
			//需要根据个各项目定义的通用获取option的链接
			this.url = "/content.xml?content=" + this.content;
		}
		this.method = this.obj.getAttribute("method");
		this.valueProperty = this.obj.getAttribute("valueProperty");
		this.textProperty = this.obj.getAttribute("textProperty");
				
		//记录dependon的参数
		this.param = {};
		this.free = {};
		this.removeParam = function (paramName) {
			if (paramName && paramName != "")
				delete this.param[paramName];
		};
		this.setParam = function (paramName, paramValue) {	
			if (paramName && paramName != "" && paramValue && paramValue != "") {
				this.param[paramName] = paramValue;
			}	
		};
		this.getParam = function () {
			return hashToParam(this.param);
		}
		this.isFree = function () {
			return hashToBool(this.free);
		}
		
		//event
		var oThis = this;
		var f = function (event) {oThis.filterOption(event);}
		if (document.all) {
			this.obj.attachEvent("onkeyup", f);
		} else {
			this.obj.addEventListener("keyup", f, false);
		}
		
		//div 层上的key事件
		this.objDiv.onkeydown = function (event) {
			//esc
			if (event.keyCode == 27) {
				oThis.objDiv.clearItemSelected();
				oThis.obj.focus();
			//回车，表示选中改值
			} else if (event.keyCode == 13) {
				var its = oThis.objDiv.getSelectedItems();
				if (its && its[0]) {
					oThis.obj.value = its[0].innerText;
					oThis.obj.focus();
					oThis.hideComboxDiv();
				}
			}
			event.cancelBubble = true;
	    	event.returnValue = false;
		}
		//div 层上的点击事件
		this.objDiv.onclick = function () {
			var its = oThis.objDiv.getSelectedItems();
			if (its && its[0]) {
				oThis.obj.focus();
				oThis.obj.value = its[0].innerText;
				oThis.hideComboxDiv();
			}
		}
		
		this.objDiv._htmlElement.onmouseleave = function () {
			oThis.hideComboxDiv();
			oThis.checkMatchOption();
		}
		
		//按钮的点击事件
		this.objButton.onclick = function () {
			if (!oThis.opened) {
				var cs = oThis.objDiv.children();
				for (var i = 0; i < cs.length; i++) {
					var t = cs[i].innerText;
					oThis.objDiv.showChild(cs[i]);
					if (t == oThis.obj.value) {
						oThis.objDiv.setItemSelected(cs[i], true);
					}
				}
				oThis.showComboxDiv();
			} else
				oThis.hideComboxDiv();
				oThis.checkMatchOption();
		}
	}
	
	//keyup时过滤选项
	Combox.prototype.filterOption = function (event) {
		//回车
		if (event.keyCode == 13) {
			this.hideComboxDiv();
			//如果必须是option中的一个,当回车时,当前输入是否时option中的一个,如果是就继续,如果不是需要将value清空
			this.checkMatchOption();
		//esc
		} else if (event.keyCode == 27) {
			this.hideComboxDiv();
			//如果必须是option中的一个,当esc时置空
			if (this.match) this.obj.value = ""
		//上移
		} else if (event.keyCode == 38) {
			if (!this.opened)
				this.showComboxDiv();
				
			var l = this.objDiv.getItems().length;
			if (l != 0) {
				this.objDiv.setItemSelected(this.objDiv.getItem(l-1), true);
				this.objDiv.getItem(l-1).focus();
			}
		//下移	
		} else if (event.keyCode == 40) {
			if (!this.opened)
				this.showComboxDiv();
				
			var l = this.objDiv.getItems().length;
			if (l != 0) {
				this.objDiv.setItemSelected(this.objDiv.getItem(0), true);
				this.objDiv.getItem(0).focus();
			}
			
		//输入值
		} else {
			if (!this.opened)
				this.showComboxDiv();
			
			//根据已经输入的值过滤
			var v = this.obj.value;
			var cs = this.objDiv.children();
			//计数已经匹配上的
			var index = 0;
			for (var i = 0; i < cs.length; i++) {
				var t = cs[i].innerText;
				if (isValid(t) && t.startWith(v, true)) {
					this.objDiv.showChild(cs[i]);
					this.objDiv.setItemSelected(cs[i], false);
					index++;
				} else {
					this.objDiv.hideChild(cs[i]);
				}
			}
//			if (index == 0) {
//				
//			} else if (index == 1) {
//				
//			} else {
//				
//			}
		}
	}
	
	Combox.prototype.checkMatchOption = function () {
		if (this.match) {
			var o = this.indexOfOptionValue();
			if (o == null) this.obj.value = "";
		}
	}
	
	Combox.prototype.indexOfOptionValue = function () {
		var cs = this.objDiv.children();
		for (var i = 0; i < cs.length; i++) {
			var t = cs[i].innerText;
			if (t == this.obj.value) {
				return cs[i];
			}
		}
		return null;
	}
	
	Combox.prototype.showComboxDiv = function () {
		//置打开的标志
		this.opened = true;
		
		//定位层的xy
		var dTop = posLib.getBoundingClientBottom(this.obj);
		var dLeft = posLib.getBoundingClientLeft(this.obj);		
		this.objDiv.show(dLeft, dTop);
	}
	
	Combox.prototype.hideComboxDiv = function () {
		//置打开的标志
		this.opened = false;
		this.objDiv.hidden();
	}
	
	
	Combox.prototype.addOption = function (value, text) {
		this.objDiv.appendItem(text);
	}
	
	Combox.prototype.clearOption = function () {
		if (typeof this.onOptionUnload == "function") {
			this.onOptionUnload();
		}
		this.objDiv.clearItem();
		this.obj.value = "";
	}
	
	//获取选项
	Combox.prototype.fetchOption = function () {
		//url空，表示改select控件不是需要动态改变可选项的
		if (this.url == null) return;
		//处理带入的参数
		var fp = this.getParam();
		var fu = (fp && fp != null)?this.url + fp:this.url;
		
		//通过http提交请求
		var http = new HttpObject();
		var ret = null;
		if (this.method == 'POST')
			ret = http.httpPostReturnMaps(this.url, fp);
		else
			ret = http.httpGetReturnMaps(fu);
			
		//处理获取的数据
		if (isValid(this.valueProperty) && isValid(this.textProperty)) {
			//清除现有选项
			this.clearOption();
			//新增选项
			for (var i = 0; i < ret.length; i ++) {
				var v = ret[i][this.valueProperty];
				var t = ret[i][this.textProperty];	
				this.addOption(v, t);
			}
				
			if (typeof this.onOptionLoad == "function") {
				this.onOptionLoad();
			}
		}
	}
	
	//depend
	Combox.prototype.dependOn = function (dependOnId, weakDepend, dependParam) {
		var obj = this;
		
		var dependObj = document.getElementById(dependOnId);
		if (dependObj) {
			var change = function () {
				//以下是和控件相关的方法
				//如果依赖的控件值不为空
				if (dependObj.value && dependObj.value != "") {
					//允许改依赖开锁
					obj.free[dependOnId] = true;
					//参数带入
					if (dependParam) {
						obj.setParam(dependParam, dependObj.value);
					} else {
						obj.setParam(dependObj.name, dependObj.value);
					}
					//获取选项
					if (obj.isFree())
						obj.fetchOption();
				
				//如果依赖的控件值空
				} else {
					if (dependParam) {
						obj.removeParam(dependParam);
					} else {
						obj.removeParam(dependObj.name);
					}
					
					//如果弱依赖关系，那么则获取选项
					if (weakDepend) {
						obj.free[dependOnId] = true;
						if (obj.isFree())
							obj.fetchOption();
					//不是弱依赖关系，那么清除所有选项	
					} else {
						obj.free[dependOnId] = false;
						obj.clearOption();
					}
				}
			}
			//IE
			if (document.all)
				dependObj.attachEvent("onchange", change);
			//FireFox
			else
				dependObj.addEventListener("change", change, false);
			change();
		}
	}